package com.itheima.dao;

import com.github.pagehelper.Page;
import com.itheima.pojo.CheckGroup;
import com.itheima.pojo.CheckItem;
import com.itheima.pojo.Member;
import org.apache.ibatis.annotations.Param;
import com.itheima.pojo.Setmeal;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;
import java.util.Set;

public interface MemberDao {
    public List<Member> findAll();
    public Page<Member> selectByCondition(String queryString);
    public void add(Member member);
    public void deleteById(Integer id);
    public Member findById(Integer id);
    public Member findByTelephone(String telephone);
    public Integer findMemberCountBeforeDate(String date);
    public Integer findMemberCountByDate(String date);
    public Integer findMemberCountAfterDate(String date);
    public Integer findMemberTotalCount();

    List<Member> findUserNameList();

   int findUserIdByName(String name);

    void setUserAndRole(Map<String,Object> map);


    String findUserName(Integer id);


    //注意往数据库传递两个值时,需要加@param
    void updateMemberAndUser(@Param(value="memberId") Integer memberId, @Param(value="userId")int userId);

    long findGroupCountByCheckItemId(Integer id);

    //根据会员id查询预约地址第一步
    int findOrderIdById(Integer id);
    //根据会员id查询预约地址第2步
    String findAddressById(Integer id);

    //查询套餐名
    String findMeal(Integer id);

    //查询套餐id
    int findMealId(String mealName);
    //套餐id查询检查组
    List<CheckGroup> findcheckGroup(int mealId);

    /*根据检查组名获取检查组id*/
    int  findcheckGroupId(String checkGroup);
    /*查询检查项*/
    Set<CheckItem> findCheckItem(int groupId);


    //完善用户信息
    void edit(Member member);

    //根据输入时间查询
    List<Setmeal> findByDate(@Param("date1") String date1, @Param("date2") String date2, @Param("id") Integer id);
    void updateMember(Member member);

    Member findByTelAndPassword(Map map);

    //根据memberId获取
    int findMemberAndUserCount(Integer memberId);

    /*
     * author:苏林
    */

    //完善用户信息
    void editMemberInfo(Member member);

    //根据输入时间查询
    List<Map<String, String>> findByDateAndTelephone(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("telephone") String telephone);

    //查询预约详细信息
    Map<String,String> findDetail(Integer orderId);

    //查询所有
    List<Map<String, String>> findAllDetails(String telephone);


}



